/*
 * Buffer.h
 *
 *  Created on: Nov 9, 2012
 *      Author: root
 */

#ifndef zeus_BUFFER_H_
#define zeus_BUFFER_H_

#include <vector>

#include "base/Types.h"

namespace zeus
{

class Buffer
{
	vector<char> _data;

	size_t _read;
	size_t _write;

public:
	Buffer();
	virtual ~Buffer();

public:

	void swap(Buffer & rhs);

	void reserve(size_t size);

public:

	char * data();

	const char * data()const;

	char * read_data();

	const char * read_data()const;

	char * write_data();

	const char * write_data()const;

public:

	size_t readable_size()const;

	size_t writeable_size()const;

	size_t size()const;

public:

	void produce(size_t size);

	void consume(size_t size);

	void clear();

	void reset(size_t size);
};

} /* namespace zeus */
#endif /* zeus_BUFFER_H_ */
